package com.cx.service;

import com.cx.entity.Dept;
import com.cx.mapper.DeptMapper;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

@Data
@Service
public class DeptServiceImpl implements DeptService {
    @Autowired
    // 引入的都是接口，不是实现类
    private DeptMapper deptMapper;

    @Override
    public Dept getDeptById(int id) {
        Dept deptById = deptMapper.getDeptById(id);
        return deptById;
    }

    @Override
    public Boolean updateDept(Dept dept) {
        int i = deptMapper.updateDept(dept);
        return i > 0;
    }

    @Override
    public Boolean deleteDeptById(int id) {
        int i = deptMapper.deleteDeptById(id);
        return i > 0;
    }

    @Override
    public Boolean insertDept(Dept dept) {
        int i = deptMapper.insertDept(dept);
        return i > 0;
    }
}
